home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mcwint20.zip / WTUTOR20.C < prev    next >
Text File  |  1988-01-11  |  43KB  |  1,234 lines

  1. #define USE_LOCAL
  2. #define TRUE           1
  3. #define FALSE          0
  4. #define ENTER          13
  5. #define ESCAPE         27
  6. #define RGTARROW       77
  7. #define LFTARROW       75
  8. #define HIDDEN_CURSOR  8192
  9.  
  10. #include <stdio.h>
  11. #include <conio.h>
  12. #include <alloc.h>
  13. #include <color.h>
  14. #include <w1.h>
  15. #include <windprot.h>
  16.  
  17. void         show_initial_screen(void);
  18. void         loop_the_loop(void);
  19. void         display_main_menu(void);
  20. void         display_window_menu(int *);
  21. void         display_misc_menu(int *);
  22. void         show_initwindow(int);
  23. void         show_makewindow(int);
  24. void         show_borders(void);
  25. void         show_removewindow(int);
  26. void         show_titlewindow(int);
  27. void         show_scrollwindow(int);
  28. void         show_specialeffects(int);
  29. void         show_maxwndw(int);
  30. void         show_qwik21(int);
  31. void         show_programming(int);
  32. void         show_ending(void);
  33. void         show_getstring(int);
  34. void         show_getinteger(int);
  35. void         show_getmenu(int);
  36. void         show_wsound(int);
  37. void         show_wsleep(int);
  38. void         show_introduction(int);
  39. void         show_autodemo(void);
  40. int          m_special(int,int*);
  41. void         main(void);
  42.  
  43. int s_row[14] = {2,2,2,2,2,8,14,20,20,20,20,20,14,8};
  44. int s_col[14] = {6,21,36,51,66,66,66,66,51,36,21,6,6,6};
  45. int n_rows    = 5;
  46. int n_cols    = 10;
  47. int auto_menu = 0;                    /* auto menu flag */
  48. int m_item    = 0;
  49.  
  50.     char *stra[33] = {
  51.         " WINDOWS and QUICK WRITE UTILITIES FOR C ",
  52.         "               Version 2.0               ",
  53.         "      (C) 87,88 Michael G. Mlachak       ",
  54.         "      (C) 87,88 Brian L. Cassista        ",
  55.         "   Fast - Small - Easy   ",
  56.         "        C H E A P        ",
  57.         "                         ",
  58.         " Supports many modes and ",
  59.         "      many monitors      ",
  60.         " To register a copy send $55 to the       ",
  61.         " above address. Registration includes     ",
  62.         " complete source code and printed manual. ",
  63.         " Libraries are available for Turbo-C,     ",
  64.         " Microsoft 4.0 and 5.0. All memory models ",
  65.         " are supported. If you do not wish to     ",
  66.         " become a registered user libraries for a ",
  67.         " specific model and compiler can be       ",
  68.         " obtained for $10 each. A printed bound   ",
  69.         " manual can also be obtained for $10.     ",
  70.         " Michael G. Mlachak   ",
  71.         " 4318 Stewart Court   ",
  72.         " East Chicago, IN.    ",
  73.         "              46312   ",
  74.         " WORK: (312)-407-5343 ",
  75.         " HOME: (219)-397-8952 ",
  76.         " CIS : 76327,1410     ",
  77.         " Brian L. Cassista    ",
  78.         " 165 South Floyd Lane ",
  79.         " Chicago Hts, IL.     ",
  80.         "              60411   ",
  81.         " WORK: (312)-407-5358 ",
  82.         " HOME: (312)-756-3567 "
  83.     };
  84.  
  85.     char *strb[2] = {
  86.        " Windows are as easy as 1, 2, 3....... ",
  87.        " The rest of this DEMO is menu driven. ",
  88.     };
  89.  
  90.     char *main_menu[10] = {
  91.        "General",
  92.        "Windows",
  93.        "Screen",
  94.        "Misc.",
  95.        "Auto Demo",
  96.        "Exit Demo",
  97.        " MC-WINDOWS (TURBO 1.0 DEMO)═════════════ <- -> - Select   Enter-Accept ",
  98.        " ",
  99.        ""
  100.     };
  101.  
  102.     char *strc[8] = {
  103.       "initwindow",
  104.       " ",
  105.       "FORMAT:   void initwindow (int windowattribute,",
  106.       "                           int clear_screen)",
  107.       "Initwindow initializes  several variables required  by  the",
  108.       "windowing package,  as well as selecting the foreground and",
  109.       "background colors of the initial screen display. Initwindow",
  110.       "must be called before using any of the other functions.    "};
  111.  
  112.     char *strd[17] = {
  113.       "makewindow",
  114.       " ",
  115.       "FORMAT:  void makewindow (int row,col,rows,cols,wattr,battr,",
  116.       "                                            BORDERS brdrsel);",
  117.       " ",
  118.       "Makewindow puts a new blank window on the display.  The window starts",
  119.       "at the upper left corner (row,col)  and extends for a number of  rows",
  120.       "and columns (rows,cols).   If a border exists, the actual  dimensions",
  121.       "of the TURBO C window will be 2 less than indicated in the makewindow",
  122.       "statement.  The border can be one of the following: (SEE w1.h)",
  123.       " ",
  124.       "   nobrdr     - just window       evensolidbrdr - evenly solid",
  125.       "   blankbrdr  - blank spaces      thinsolidbrdr - thin solid line",
  126.       "   singlebrdr - single line       lhatchbrdr - light hatch",
  127.       "   doublebrdr - double line       mhatchbrdr - medium hatch",
  128.       "   mixedbrdr  - single/double     hhatchbrdr - heavy hatch",
  129.       "   solidbrdr  - solid             userbrdr   - user defined border"};
  130.  
  131.     char *stre[18] = {
  132.       "removewindow",
  133.       "FORMAT:   void removewindow(void);",
  134.       " ",
  135.       "Removewindow removes the last window",
  136.       "remaining  on  the screen  from  the",
  137.       "makewindow function.",
  138.       "remove_windows",
  139.       "FORMAT:   void remove_windows(int);",
  140.       " ",
  141.       "Remove_windows removes the number of",
  142.       "windows specified. It checks to see ",
  143.       "if there are that amount to remove. ",
  144.       "remove_all_windows",
  145.       "FORMAT: void remove_all_windows(void);",
  146.       " ",
  147.       "Remove_all_windows removes all of   ",
  148.       "the currently displayed windows from",
  149.       "the makewindow function."};
  150.  
  151.     char *strf[2] = {
  152.       "See if your BIOS gives you flicker",
  153.       "when your screen rolls down next ..."};
  154.  
  155.     char *strg[19] = {
  156.       " ",
  157.       "    scrollwindow",
  158.       " ",
  159.       " ",
  160.       "FORMAT:  void scrollwindow (byte rowbegin,rowend byte; DIRTYPE dir);",
  161.       "",
  162.       "The BIOS scroll that was used for this call may have worked just fine",
  163.       "for this window.  However, if  your screen just had some bad flicker ",
  164.       "as it was scrolling down, your BIOS is not flicker-free.  To keep the",
  165.       "display flicker-free,  to work on other  video pages  or an EGA, then",
  166.       "you will need this function.  The upward  scroll, used scrollwindow, ",
  167.       "so no flicker was seen then.  It also scrolls partial windows.",
  168.       " ",
  169.       "The direction of the scroll can be any of the following:(SEE w1.h)",
  170.       " ",
  171.       "    'up'   - to scroll up",
  172.       "    'down' - to scroll down",
  173.       " ",
  174.       " "};
  175.  
  176.     char *strh[7] = {
  177.       "titlewindow",
  178.       "FORMAT: void titlewindow(justify,title,attr);",
  179.       "        enum DIRTYPE justify; char title[80]",
  180.       "        int attr                            ",
  181.       "Titlewindow places a title in the top border",
  182.       "of the current window.  Justify permits left,",
  183.       "center or right justification of the title."};
  184.  
  185.     char *stri[17] = {
  186.       "There are now two special effects that can",
  187.       "enhance the window display:",
  188.       "   zoomeffect   - emulates the MACINTOSH.",
  189.       "   shadoweffect - places a left or right",
  190.       "              shadow underneath the menu.",
  191.       "These global variables can be placed anywhere",
  192.       "in your program.  zoomeffect is INT while",
  193.       "shadoweffect is of DIRTYPE.",
  194.       "CGA:",
  195.       "The CGA is self-regulating and controls the",
  196.       "zoom rate.",
  197.       "MDA and EGA:",
  198.       "These video cards are quite fast and need a",
  199.       "delay for the effect.  A default value of 11",
  200.       "milliseconds is used in a global INT",
  201.       "named 'zoomdelay' and shouldn't need any",
  202.       "adjustment."};
  203.  
  204.     char *strj[5] = {
  205.       " The maximum  number  of windows that",
  206.       " may be on the screen at any one time",
  207.       " is   specified   by   the   constant",
  208.       " \"MAXWNDW\".The compiled library uses",
  209.       " this value so do NOT change it......"};
  210.  
  211.     char *strk[9] = {
  212.       " In addition to windows, there are 13 powerful",
  213.       " Qwik-Write screen functions  you can use:",
  214.       "      qwritelv   qattr      qpage",
  215.       "      qwrite     qattrc     qwritepage",
  216.       "      qwritec    gotorc     cursorchange",
  217.       "      qfillc     qstore               ",
  218.